package com.sky.mapper;

import com.sky.annotation.AutoFill;
import com.sky.dto.DishDTO;
import com.sky.entity.Dish;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface DishMapper {
    /**
     * 新增菜品和对应的口味
     * @param dish
     */
//    @Insert("insert into dish(name, category_id, price, image,description,status)"
//            +" values"+
//            "(#{name}, #{categoryId}, #{price}, #{image},#{description},#{status})")
    @AutoFill(value = OperationType.INSERT)
    void save(Dish dish);

    /**
     * 根据分类id查询菜品数量
     * @param categoryId
     * @return
     */
    @Select("select count(id)  from dish where category_id = #{categoryId}")
    Integer countByCategoryId(Long categoryId);
}
